package com.itheima.dao;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface OrderSettingMapper {

    @Select("select count(*) from t_ordersetting where orderDate = #{orderDate}")
    Integer findCountByDate(Date orderDate);

    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    void edit(OrderSetting orderSetting);

    @Insert("insert into t_ordersetting (orderDate,number) values(#{orderDate},#{number})")
    void add(OrderSetting orderSetting);

    @Select("SELECT * FROM t_ordersetting where orderDate between #{startDate} and #{endDate}")
    List<OrderSetting> findOrderSettingByMonth(@Param("startDate") String startDate, @Param("endDate") String endDate);

    @Select("SELECT * FROM t_ordersetting where orderDate = #{orderDate}")
    OrderSetting findByDate(@Param("orderDate") Date orderDate);

    @Update("update t_ordersetting set reservations = #{reservations} where orderDate = #{orderDate}")
    void editReservations(OrderSetting orderSetting);
}
